
package com.scs.application.modules.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.scs.application.core.model.ImportResult;
import com.scs.application.core.service.IBaseService;
import com.scs.application.modules.order.dto.DeliveryItemAddBySelectDTO;
import com.scs.application.modules.order.dto.DeliveryItemSplitDTO;
import com.scs.application.modules.order.entity.Delivery;
import com.scs.application.modules.order.entity.DeliveryItem;
import com.scs.application.modules.order.request.DeliveryItemQueryRequest;
import com.scs.application.modules.order.vo.DeliveryItemVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * 发货单明细 service 接口
 */
public interface DeliveryItemService extends IBaseService<DeliveryItem> {

    List<DeliveryItemVO> list(DeliveryItemQueryRequest request);

    IPage<DeliveryItem> page(DeliveryItemQueryRequest request);

    /**
     * @param delivery 剩余采购订单明细
     * @Description:
     * @return: java.util.List<com.scs.application.modules.order.entity.DeliveryItem>
     */
    List<DeliveryItem> surplusPurchaseOrder(Delivery delivery);

    /**
     * @param entity
     * @Description: 保存明细
     * @return: boolean
     */
    boolean saveDeliveryItemsById(DeliveryItem entity);

    boolean updateDeliveryItemsById(DeliveryItem entity);

    /**
     * @param newArrayList
     * @Description: 批量保存明细
     * @return: boolean
     */
    boolean saveOrUpdateBatchDtl(List<DeliveryItem> newArrayList);

    boolean deleteById(String id);

    /**
     * @param request
     * @Description: 所有发货单明细查询
     * @return: com.baomidou.mybatisplus.core.metadata.IPage
     */
    IPage<DeliveryItemVO> allDeliveryPage(DeliveryItemQueryRequest request);

    /**
     * 获取下载数据
     * @param deliveryId
     * @return
     */
    List<DeliveryItem> getExportDeliveryItems(String deliveryId);

    /**
     * @description: 下载导入模板
     * @param deliveryId 发货单Id
     **/
    void downloadExcelTemp(HttpServletResponse response,String deliveryId);

    /**
     * @description: 根据导入模板导入数据
     * @param deliveryId 发货单Id
     **/
    ImportResult importDtl(MultipartFile file, String deliveryId);

    List<String> splitDtl(@Valid DeliveryItemSplitDTO entity);

    void addBySelect(@Valid List<DeliveryItemAddBySelectDTO> children);

    // 更新发货明细的已发货数量
    void updateDeliveredQty(String deliveryId);
}
